package com.dy.mapper;

import com.dy.domain.FenLei;
import com.dy.domain.TuShu;
import com.dy.domain.XinXi;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface TuShuMapper {

    List<TuShu> mohu(String ming);


    @Insert("insert into tushu values(null,#{bookname},#{price},#{author},#{lei})")
    void add(TuShu tuShu);

    @Select("select * from tushu where tid = ${value}")
    TuShu huixian(Integer tid);

    @Update("update tushu set bookname = #{bookname},price = #{price},author = #{author},lei = #{lei} where tid = #{tid}")
    void update(TuShu tuShu);

    @Delete("delete from tushu where tid = #{value}")
    void del(Integer tid);

    @Select("select lei name,count(lei) value from tushu group by lei")
    List<XinXi> cha();

    @Select("select * from tushu")
    List<TuShu> findall();
}
